#include "m_cmd_pass.h"
#include "m_cmd.h"
#include "m_log.h"
#include "m_nrf2401.h"

static int g_nrf_init_state = -1;

int m_cmd_pass(cmd_req_pass pass)
{
    if (pass.type == SPI) {
        unsigned int r = m_nrf_tx_mode();
        if (r != 0) {
            m_log_e(M_CMD_PASS_H, "nrf tx mode fail: 0x%02x\n", r);
            return r;
        }
        r = m_nrf_host_tx_data(pass.buf, pass.size);
        if (r != 0) {
            m_log_e(M_CMD_PASS_H, "nrf host tx data fail: 0x%02x\n", r);
            return r;
        }
        return 0;
    }
    m_log_w(M_CMD_PASS_H, "cmd pass type not support: %d\n", pass.type);
    return 1;
}